<?php

namespace app\model\desktop;

use app\model\BaseModel;
use app\helper\desktop\RouteHelper;
use app\helper\DictionaryHelper;
use Exception;
use Sunqianhu\Helper\SingletonFactory;

class RouteModel extends BaseModel
{
    protected $name = 'desktop_route';

    /**
     * 得到布局容器名称
     * @param $value
     * @param $data
     * @return null
     * @throws Exception
     */
    public function getLayoutNameAttr($value, $data)
    {
        $dictionaryHelper = SingletonFactory::getInstance(DictionaryHelper::class);
        return $dictionaryHelper->getValue('desktop_route_layout', $data['layout']);
    }

    /**
     * 得到保活名称
     * @param $value
     * @param $data
     * @return null
     * @throws Exception
     */
    public function getKeepAliveNameAttr($value, $data)
    {
        $dictionaryHelper = SingletonFactory::getInstance(DictionaryHelper::class);
        return $dictionaryHelper->getValue('desktop_route_keep_alive', $data['keep_alive']);
    }
}
